<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: inc.get_subcategories.php 378 2014-01-18 11:28:36Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 378 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2014-01-18 11:28:36 +0000 (Sat, 18 Jan 2014) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

function get_subcategories(&$subcategories_array, $parent_id = 0, $ebene = 0) {
	global $db;
	if (!defined('PRODUCT_LISTING_SHOW_PRODUCTS_EBENEN'))
    $enabled_ebenen = -1;
  else   	 
    $enabled_ebenen = PRODUCT_LISTING_SHOW_PRODUCTS_EBENEN;
    
  if ($enabled_ebenen >= 0 && $ebene < $enabled_ebenen) {
  	$subcategories = $db->db_query("SELECT categories_id FROM ".TABLE_CATEGORIES." WHERE parent_id = '".$parent_id."'");
  
  	while(!$subcategories->EOF) {
  		$subcategories_array[sizeof($subcategories_array)] = $subcategories->fields['categories_id'];
  		if($subcategories->fields['categories_id'] != $parent_id)
  			get_subcategories($subcategories_array, $subcategories->fields['categories_id']);
  		$subcategories->MoveNext();
  	}
  }
}
?>